package DAO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import java.util.Vector;

 public class DaoQuery2 {
    public DaoQuery2() {
    }
    
    public static Vector< Vector<String> > execute(int numero)
    {
    Vector< Vector<String> > matriz=new Vector< Vector<String> >();
    Conexion conexion = new Conexion();
    Connection conex;

    try {
     conex = conexion.getConnection();
     PreparedStatement ps = null;
     ResultSet rs = null;

     ResultSet rsa = null;
     String nombre =new String("");
     ps = conex.prepareStatement("select ex.numberexamination,ex.description,p.petnumber,p.petname\n" + 
     "from examination ex, pet p\n" + 
     "where p.PETNUMBER=ex.PETNUMBER and p.petNumber=?");
     ps.setInt(1,numero);
     rsa = ps.executeQuery();
      
      
     if (rsa != null) {
       while (rsa.next()) {
             Vector<String>  fila =new Vector<String>();
              fila.add( rsa.getString("ex.numberexamination"));
              fila.add( rsa.getString("ex.description"));
              fila.add(rsa.getString("p.petnumber"));
              fila.add(rsa.getString("p.petname"));
                     
           matriz.add(fila);
          }
     }           
     conex.close();

    } catch (SQLException ex) {
     System.err.println("SQLException: " + ex.getMessage());

    }
    return matriz;
    }
    
   
}